
#pragma once

#include <AVUIRangeBase.h>

namespace AVUI {
class Track;
class RoutedEventArgs;
class SizeChangedEventArgs;
class ProgressBar : public RangeBase
{
public:
    ProgressBar() : m_pTrack(NULL), m_pIndicator(NULL) { };
    ~ProgressBar() { };

    DECLARE_ELEMENT(ProgressBar, RangeBase);

    DECLARE_DEPENDENCY_PROPERTY(Orientation);
    Orientation::Enum get_Orientation() { return (Orientation::Enum)(AVUI::UnboxValue<int>(GetValue(get_OrientationProperty()))); }
    void set_Orientation(Orientation::Enum value) { SetValue(get_OrientationProperty(), AVUI::BoxValue<int>(value)); } 

protected:
    virtual void OnApplyTemplate();
    virtual void OnMinimumChanged() { SetProgressBarIndicatorLength(); }
    virtual void OnMaximumChanged() { SetProgressBarIndicatorLength(); }
    virtual void OnValueChanged()   { SetProgressBarIndicatorLength(); }

private:
    static void StaticConstructor();

    void OnTrackSizeChanged(Object* pObject, SizeChangedEventArgs* pEventArgs) { SetProgressBarIndicatorLength(); }
    void SetProgressBarIndicatorLength();


    FrameworkElement* m_pTrack;
    FrameworkElement* m_pIndicator;
};


}; // namespace AVUI
